<template>
  <div class="personal-information information-container">
    <div class="title">
      <div class="text">
        *Personal Information
      </div>
      <a-button
        size="small"
        shape="round"
        class="ant-btn-default"
        @click="editPersionInfo"
      >
        edit
      </a-button>
    </div>
    <div class="infos-container">
      <a-form
        id="formLogin"
        ref="formLogin"
        :form="form"
        :label-col="{ span: 8 }"
        :wrapper-col="{ span: 16 }"
      >
        <a-form-item
          style="margin-bottom:0;"
          :wrapper-col="{ span: 24 }"
        >
          <!-- { xs: 8, sm: 16, md: 24, lg: 32 }span: 8 -->
          <a-form-item
            :label-col="{ span: 17 }"
            :wrapper-col="{ span: 7 }"
            label="First Name:"
            :colon="false"
            :style="{ display: 'inline-block', width: 'calc(50% - 20px)', 'margin-right': '40px' }"
          >
            <span class="value-text">{{ currentUser.first_name }}</span>
          </a-form-item>

          <a-form-item
            label="Last Name:"
            :colon="false"
            :wrapper-col="{ span: 7 }"
            :style="{ display: 'inline-block', width: 'calc(50% - 20px)' }"
          >
            <span class="value-text">{{ currentUser.last_name }}</span>
          </a-form-item>
        </a-form-item>

        <a-form-item
          label="Date Of Birth:"
          :colon="false"
        >
          <span class="value-text">{{ currentUser.birthday | filterNo }}</span>
        </a-form-item>

        <a-form-item
          label="Gender:"
          :colon="false"
        >
          <span class="value-text">{{ currentUser.gender | filterGender }}</span>
        </a-form-item>

        <a-form-item
          label="Residential Address"
          :colon="false"
          class="residential-address"
        />
        <!-- 0412131414@qq.com -->
        <!-- #MHpY-$a -->
        <a-form-item
          label="Street Address:"
          :colon="false"
        >
          <span class="value-text">{{ unitAndStreet }}</span>
        </a-form-item>

        <a-form-item
          label="Suburb:"
          :colon="false"
        >
          <span class="value-text">{{ currentUser.district | filterNo }}</span>
        </a-form-item>

        <a-form-item
          label="State:"
          :colon="false"
        >
          <span class="value-text">{{ stateAndPostCode }}</span>
        </a-form-item>

        <a-form-item
          style="margin-bottom:0;"
          :wrapper-col="{ span: 24 }"
          v-if="false"
        >
          <!-- { xs: 8, sm: 16, md: 24, lg: 32 }span: 8 -->
          <a-form-item
            :label-col="{ span: 17 }"
            :wrapper-col="{ span: 7 }"
            label="State:"
            :colon="false"
            :style="{ display: 'inline-block', width: 'calc(50% - 20px)', 'margin-right': '40px' }"
          >
            <span class="value-text">{{ stateAndPostCode }}</span>
          </a-form-item>

          <!-- <a-form-item
            label="Post Code:"
            :colon="false"
            :wrapper-col="{ span: 7 }"
            :style="{ display: 'inline-block', width: 'calc(50% - 20px)' }"
          >
            <span class="value-text">{{ currentUser.post_code }}</span>
          </a-form-item> -->
        </a-form-item>

        <a-form-item
          label="Driver Licence No:"
          :colon="false"
        >
          <span class="value-text">{{ currentUser.driver_licence_number | filterNo }}</span>
        </a-form-item>

        <a-form-item
          label="Licence Expiry:"
          :colon="false"
        >
          <span class="value-text">{{ currentUser.driver_expire_date | filterNo }}</span>
        </a-form-item>

        <a-form-item
          label="Licence Issued By:"
          :colon="false"
        >
          <span class="value-text">{{ currentUser.driver_state | filterNo }}</span>
        </a-form-item>
      </a-form>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
import personal from './personal';

export default {
  mixins: [personal],

  data() {
    return {
      form: this.$form.createForm(this)
    };
  },

  computed: {
    ...mapGetters(['currentUser']),

    unitAndStreet() {
      const { unit, street } = this.currentUser;
      return street ? `${unit || ''} ${street}` : '/';
    },
    
    stateAndPostCode() {
      const { state, post_code } = this.currentUser
      return state && post_code
        ? `${state} ${post_code}`
        : 'None'
    }
  }
};
</script>

<style lang="scss" scoped>
.personal-information {
  padding: 0px 70px 0px 90px;
  & > .title {
    margin-bottom: $margin-xs;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .infos-container {
    padding-left: 6px!important;
    padding-right: 280px!important;
  }

  .ant-form-item {
    margin-bottom: $margin-xs;
    .ant-form-item-label {
      line-height: $line-height-xs;
    }
  }
}

@media (max-width: $screen-lg) {
  .personal-information {
    padding: $padding-xs;
    .infos-container {
      padding-left: 6px!important;
      padding-right: 0px!important;
    }
  }
}
</style>

<style scoped>
 .residential-address {
    font-weight: bold;
  }
</style>
